gl renderer: Avoid some code duplication
authorTimm Bäder <mail@baedert.org>
Sun, 31 Dec 2017 07:45:40 +0000 (08:45 +0100)
committerTimm Bäder <mail@baedert.org>
Tue, 2 Jan 2018 07:10:06 +0000 (08:10 +0100)
gsk/gl/gskglrenderer.c

index 8b4f7439a27a1903ddb768478cefcb91ef0ee648..7a69d59d422ef0f697404a865d81c0d48128a0fe 100644 (file)
@@ -957,42 +957,30 @@ render_outset_shadow_node (GskGLRenderer       *self,
   if (blur_radius > 0)
     {
       ops_set_program (builder, &self->blur_program);
-      ops_set_clip (builder, &blit_clip);
-      ops_set_texture (builder, texture_id);
       op.op = OP_CHANGE_BLUR;
-      op.blur.dir[0] = 1;
-      op.blur.dir[1] = 0;
       op.blur.size.width = texture_width;
       op.blur.size.height = texture_height;
       op.blur.radius = blur_radius;
       ops_add (builder, &op);
-
-      ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
-        { { 0,             0              }, { 0, 1 }, },
-        { { 0,             texture_height }, { 0, 0 }, },
-        { { texture_width, 0              }, { 1, 1 }, },
-
-        { { texture_width, texture_height }, { 1, 0 }, },
-        { { 0,             texture_height }, { 0, 0 }, },
-        { { texture_width, 0              }, { 1, 1 }, },
-      });
     }
   else
     {
       ops_set_program (builder, &self->blit_program);
-      ops_set_clip (builder, &blit_clip);
-      ops_set_texture (builder, texture_id);
-      ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
-        { { 0,             0              }, { 0, 1 }, },
-        { { 0,             texture_height }, { 0, 0 }, },
-        { { texture_width, 0              }, { 1, 1 }, },
-
-        { { texture_width, texture_height }, { 1, 0 }, },
-        { { 0,             texture_height }, { 0, 0 }, },
-        { { texture_width, 0              }, { 1, 1 }, },
-      });
     }
 
+  ops_set_clip (builder, &blit_clip);
+  ops_set_texture (builder, texture_id);
+  ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
+    { { 0,             0              }, { 0, 1 }, },
+    { { 0,             texture_height }, { 0, 0 }, },
+    { { texture_width, 0              }, { 1, 1 }, },
+
+    { { texture_width, texture_height }, { 1, 0 }, },
+    { { 0,             texture_height }, { 0, 0 }, },
+    { { texture_width, 0              }, { 1, 1 }, },
+  });
+
+
   ops_set_clip (builder, &prev_clip);
 
   ops_set_viewport (builder, &prev_viewport);